'''
Created on Aug 6, 2013

@author: Yuanpeng_Li
1.1 Introduction.
'''

def find_best_benefit(scores):
    if scores is None or len(scores) == 0:
        return 0
    highest_score = scores[0]
    best_diff = 0
    for s in scores:
        if s > highest_score:
            highest_score = s
        d = highest_score - s
        if d > best_diff:
            best_diff = d
    return best_diff

if __name__ == '__main__':
    print (find_best_benefit([2, 3, 2, 1]))
    print (find_best_benefit([1, 2]))
    print (find_best_benefit([1]))
    print (find_best_benefit([]))
    print (find_best_benefit(None))